home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / FLEG.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  518b  |  24 lines

  1. PROCEDURE fleg(x: real; VAR pl: glnlarray; nl: integer);
  2. (* Programs using routine FLEG must define the type
  3. TYPE
  4.    glnlarray = ARRAY [1..nl] OF real;
  5. in the main routine. *)
  6. VAR
  7.    j: integer;
  8.    twox,f2,f1,d: real;
  9. BEGIN
  10.    pl[1] := 1.0;
  11.    pl[2] := x;
  12.    IF (nl > 2) THEN BEGIN
  13.       twox := 2.0*x;
  14.       f2 := x;
  15.       d := 1.0;
  16.       FOR j := 3 TO nl DO BEGIN
  17.          f1 := d;
  18.          f2 := f2+twox;
  19.          d := d+1.0;
  20.          pl[j] := (f2*pl[j-1]-f1*pl[j-2])/d
  21.       END
  22.    END
  23. END;
  24.